<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑订单</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="../../css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<div class="layui-form layuimini-form" lay-filter="spayFilter">

    <div class="layui-form-item">
        <label class="layui-form-label required">订单编号</label>
        <div class="layui-input-block">
            <input type="text" name="payId" lay-verify="required" lay-reqtext="订单编号不能为空" placeholder="请输入订单编号" value=""
                   class="layui-input" disabled>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">付款方式</label>
        <div class="layui-input-block">
            <input type="text" name="payType" lay-verify="required" lay-reqtext="付款方式不能为空" placeholder="请输入付款方式" value="" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">支付宝账号</label>
        <div class="layui-input-block">
            <input type="text" name="payAccount" lay-verify="required" lay-reqtext="支付宝账号不能为空" placeholder="请输入支付宝账号" value="" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label required">账号姓名</label>
        <div class="layui-input-block">
            <input type="text" name="accountName" lay-verify="required" lay-reqtext="账号姓名不能为空" placeholder="请输入账号姓名" value="" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">付款人</label>
        <div class="layui-input-block">
            <input type="text" name="operater" lay-verify="required" lay-reqtext="付款人不能为空" placeholder="请输入付款人" value="" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">支付金额</label>
        <div class="layui-input-block">
            <input type="text" name="payMoney" lay-verify="required" lay-reqtext="支付金额不能为空" placeholder="请输入支付金额" value="" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>
        </div>
    </div>
</div>

<script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>

    var data;

    /**
     * 主页面向role-edit.html传递参数方法
     */
    function child(data) {
        console.log(data);
        this.data = data;

        layui.use(['form'], function () {
            var form = layui.form,
                layer = layui.layer,
                $ = layui.$;

            //初始化表单
            form.val("spayFilter", {
                "payId": data.payId,
                "payType": data.payType,
                "payAccount":data.payAccount,
                "accountName": data.accountName,
                "operater": data.operater,
                "payMoney": data.payMoney,
            });

            //监听提交
            form.on('submit(saveBtn)', function (data) {
                //请求服务器操作数据库
                console.log(data);
                $.post("/wfx_manager/spay/updateSpay",
                    form.val("spayFilter"),
                    function (res) {
                        if (res) {
                            //获取iframe的唯一标识
                            var iframeIndex = parent.layer.getFrameIndex(window.name);
                            //关闭iframe窗口
                            parent.layer.close(iframeIndex);
                        }
                    }, "json");
            });
        });
    }
</script>
</body>
</html>